﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Microsoft.Phone.Tasks;
using System.Device.Location;

namespace Utility
{
    public partial class BackToHomePage : PhoneApplicationPage
    {
        GeoCoordinateWatcher gps;
        public BackToHomePage()
        {
            InitializeComponent();
            //gps = new GeoCoordinateWatcher(GeoPositionAccuracy.High);   
            gps = new GeoCoordinateWatcher();   
        }
       
        private void gohome_Click(object sender, EventArgs e)
        {
            gps.Start();
            MapsDirectionsTask mapTask = new MapsDirectionsTask();
            if (gps.Status == GeoPositionStatus.Ready) { 
                mapTask.Start = new LabeledMapLocation("I'm here.", gps.Position.Location);
                mapTask.End = new LabeledMapLocation("Siam Paragon", new GeoCoordinate(13.747233, 100.534799));
                mapTask.Show();
            }
        }
    }
}